package com.api.task.gettask;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.test.context.ContextConfiguration;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import com.api.test.AbstractApiTest;
import com.zyncro.api.ITaskApiService;
import com.zyncro.api.exceptions.ZyncroApiException;
import com.zyncro.api.model.ObjectResultApi;
import com.zyncro.api.model.TaskApi;

@ContextConfiguration(locations = { "classpath:/task/task-static.xml" })
public class GetTaskOpen extends AbstractApiTest {

	@Value("#{group_toGetOpen[notParticipant].appId}")
	private String userUrn;

	@Value("#{group_toGetOpen[notParticipant].password}")
	private String userPassword;

	@Value("#{group_toGetOpen.taskUrn}")
	private String groupTaskUrn;

	@BeforeClass
	protected void setParameters() throws Exception {

		getApi().login(userUrn, userPassword);
	}

	@Test
	public void testGetGroupTaskParticipant() throws ZyncroApiException {

		ObjectResultApi<TaskApi> result = getApi().getService(ITaskApiService.class).getTask(groupTaskUrn);
		TaskApi task = result.getObject();

		Assert.assertNotNull(task);
	}
}
